package com.ddtech.business.check.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.ddtech.business.common.BaseEntity;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * <p>
 * 学员考核记录表
 * </p>
 *
 * @author bin_pu
 * @since 2023-02-06
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("check_user_record")
@ApiModel(value="UserRecord对象", description="学员考核记录表")
public class CheckUserRecord extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "考核id")
    private String checkId;

    @ApiModelProperty(value = "类型")
    private Integer checkType;

    @ApiModelProperty(value = "学员id")
    private String userId;

    @ApiModelProperty(value = "学员名称")
    private String userName;

    @ApiModelProperty(value = "是否完成考核")
    private Integer isFinish;

    @ApiModelProperty(value = "答对题数")
    private Integer rightCount;

    @ApiModelProperty(value = "答错题数")
    private Integer wrongCount;

    @ApiModelProperty(value = "考核得分")
    private Double source;

    @ApiModelProperty(value = "所用时长(秒)")
    private Long useTime;

    @ApiModelProperty(value = "开始时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime startTime;

    @ApiModelProperty(value = "结束时间")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    @TableField(exist = false)
    private Integer rank;
    @TableField(exist = false)
    private String userHeadPortrait;
    @TableField(exist = false)
    private String userDept;

    @TableField(exist = false)
    private String isPass;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        CheckUserRecord checkUserRecord = (CheckUserRecord) o;
        return Objects.equals(super.getId(), checkUserRecord.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.getId());
    }
}
